package com.example.demo.netty.c3;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.*;

/**
 * @description:
 * @author: hhl
 * @createDate: 2024/1/25
 * @version: 1.0
 */
@Slf4j
public class TestJdkFuture {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(2);
        Future<?> future = executorService.submit(
                new Callable<Integer>() {
                    @Override
                    public Integer call() throws Exception {
                        log.debug("请假中");
                        Thread.sleep(1000);
                        return 50;
                    }
                }
        );
        System.out.println(future.get());
    }
}
